<template>
  <div class="container">
    <div class="app-container">
      <el-row style=" padding: 20px;" width="100%">
        <el-row style="border-bottom: 1px solid #ccc;" width="100%">
          <span style="margin-top: 20px;margin-left: 20px">车牌号码:</span>
          <el-input placeholder="请输入车牌号码" style="margin-top: 15px;margin-bottom: 10px; margin-left: 10px; width: 200px;" size="mini" />
          <span style="margin-top: 20px ;margin-left: 20px;">缴纳状态:</span>
          <el-select v-model="value" placeholder="请选择" size="mini">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
          <el-button type="primary" size="mini" style=" margin-top: 10px; margin-left: 20px; margin-bottom: 20px; width: 65px; border-radius: 10px  ;">查询</el-button>
        </el-row>
      </el-row>
      <template>
        <el-table
          :data="list"
          style="width: 100% "
        >
          <el-table-column label="序号" type="index" width="100" />
          <el-table-column prop="carNumber" label="车牌号码" width="100" />
          <el-table-column prop="chargeType" label="收费类型" width="100">
            <template v-slot="{row}">
              <span> {{ row.chargeType==="card"? "月卡":row.chargeType==="temp"?"临时停车":'无' }} </span>
            </template>
          </el-table-column>
          <el-table-column prop="parkingTime" label="停车总时长" width="120" />
          <el-table-column prop="actualCharge" label="缴纳费用(元)" width="100" />
          <el-table-column prop="paymentStatus" label="缴纳状态" width="100">
            <template v-slot="{row}">
              <span> {{ row.paymentStatus===1? "已缴费":row.paymentStatus===0?"未缴费":'无' }} </span>
            </template>
          </el-table-column>
          <el-table-column prop="paymentMethod" label="缴纳方式" width="100">
            <template v-slot="{row}">
              <span> {{ row.paymentMethod==="Alipay"? "支付宝":row.paymentMethod==="WeChat"?"微信":'线下' }} </span>
            </template>
          </el-table-column>
          <el-table-column prop="paymentTime" label="缴纳时间" />
        </el-table>

      </template>
      <el-row type="flex" justify="end">
        <el-pagination
          layout="prev, pager, next , jumper , total"
          :total="add.total"
          :page-size="add.pageSize"
          :current-page="add.page"
          @current-change="changePage"
        />
      </el-row>
    </div>
  </div>
</template>
<script>
import { getParkingAPI } from '@/api'

export default {
  name: 'Attendance',
  data() {
    return {
      list: [],
      add: {
        total: 0,
        name: '',
        pageSize: 10,
        page: 1
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    async getList() {
      const { rows, total } = await getParkingAPI(this.add)
      this.list = rows
      this.add.total = total
    },
    changePage(newpage) {
      this.add.page = newpage
      this.getList()
    },
    editRole(id) {
      this.currentNodeId = id
    }
  }
}
</script>
